#include "StepsOptimization.h"
#include "initialization/Initialization.h"
#include "Optimizer.h"
#include "DataManager.h"


namespace Estimator
{
StepsOptimization::StepsOptimization(Calibration &calibration): mCalibration_(calibration),
                                                                mpInit_(new initialization(calibration)),
                                                                mpOptimization_(new Optimizer(calibration))
                                                                {}

void StepsOptimization::RunOptimization(Managing* pManager)
{
    mpInit_->InitializeByManager(pManager);
    mpInit_->GenerateCostFunctionBeta(pManager);
    mpInit_->SolveOptimization();
    // output translation results into original data.
    mpInit_->UpdateManager(pManager);

    // initialize the variables again.
    mpOptimization_->InitializeByManager(pManager);
    mpOptimization_->GenerateCostFunctionBeta(pManager);
    mpOptimization_->SolveOptimization();

    return;
}

}